<?php

require_once ('Abstract.php');

class LikeMVC_View_Ajax extends LikeMVC_View_Abstract {
	
	protected $response;
	
	public function setAjaxResponse($response)	{
		$this->response = $response;
	}
	
	public function getAjaxResponse()	{
		return $this->response;
	}
	
	public function renderAjax()	{
		return $this->render(null);
	}
	
	/**
	 * Encode the response in JSON format and send it regardless of the script
	 * @see LikeMVC_View_Abstract::run()
	 */
	protected function run() {
		echo json_encode($this->response);
	}
}

?>